brushless28 2.2.0
Loading...
Searching...
No Matches
brushless28.h File Reference

This file contains API for Brushless 28 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"
#include "drv_pwm.h"

Go to the source code of this file.

Data Structures

struct  brushless28_t
 Brushless 28 Click context object. More...
struct  brushless28_cfg_t
 Brushless 28 Click configuration object. More...

Macros

#define BRUSHLESS28_REG_IC_STAT1   0x00
 Brushless 28 register list.
#define BRUSHLESS28_REG_IC_STAT2   0x01
#define BRUSHLESS28_REG_IC_STAT3   0x02
#define BRUSHLESS28_REG_IC_STAT4   0x03
#define BRUSHLESS28_REG_IC_STAT5   0x04
#define BRUSHLESS28_REG_IC_STAT6   0x05
#define BRUSHLESS28_REG_IC_CTRL1   0x1A
#define BRUSHLESS28_REG_IC_CTRL2   0x1B
#define BRUSHLESS28_REG_IC_CTRL3   0x1C
#define BRUSHLESS28_REG_GD_CTRL1   0x1E
#define BRUSHLESS28_REG_GD_CTRL2   0x1F
#define BRUSHLESS28_REG_GD_CTRL3   0x21
#define BRUSHLESS28_REG_GD_CTRL3B   0x22
#define BRUSHLESS28_REG_GD_CTRL4   0x23
#define BRUSHLESS28_REG_GD_CTRL5   0x24
#define BRUSHLESS28_REG_GD_CTRL6   0x25
#define BRUSHLESS28_REG_GD_CTRL7   0x26
#define BRUSHLESS28_REG_CSA_CTRL   0x29
#define BRUSHLESS28_REG_MON_CTRL1   0x2B
#define BRUSHLESS28_REG_MON_CTRL2   0x2C
#define BRUSHLESS28_REG_MON_CTRL3   0x2D
#define BRUSHLESS28_REG_MON_CTRL4   0x2E
#define BRUSHLESS28_REG_SPI_TEST   0x36
#define BRUSHLESS28_REG_OTP_USR   0x48
#define BRUSHLESS28_IC_CTRL2_ENABLE_DRV   0x8000
 Brushless 28 IC_CTRL2 register setting.
#define BRUSHLESS28_IC_CTRL2_MODE_NSLEEP   0x4000
#define BRUSHLESS28_IC_CTRL2_CFG_CRC_EN   0x2000
#define BRUSHLESS28_IC_CTRL2_CLKMON_EN   0x1000
#define BRUSHLESS28_IC_CTRL2_CSA_EN   0x0800
#define BRUSHLESS28_IC_CTRL2_CSA_AZ_DIS   0x0400
#define BRUSHLESS28_IC_CTRL2_GVDD_MODE_LDO   0x0100
#define BRUSHLESS28_IC_CTRL2_VCP_MODE_NORMAL   0x0000
#define BRUSHLESS28_IC_CTRL2_VCP_MODE_SW_DIS   0x0040
#define BRUSHLESS28_IC_CTRL2_VCP_MODE_SHUTDOWN   0x0080
#define BRUSHLESS28_IC_CTRL2_VCP_MODE_TCP_DIS   0x00C0
#define BRUSHLESS28_IC_CTRL2_VCP_MODE_MASK   0x00C0
#define BRUSHLESS28_IC_CTRL2_LOCK_UNLOCK   0x0006
#define BRUSHLESS28_IC_CTRL2_LOCK_LOCK   0x000C
#define BRUSHLESS28_IC_CTRL2_LOCK_MASK   0x000E
#define BRUSHLESS28_IC_CTRL2_CLR_FLT   0x0001
#define BRUSHLESS28_GD_CTRL1_PWM_MODE_6X_PWM   0x0000
 Brushless 28 GD_CTRL1 register setting.
#define BRUSHLESS28_GD_CTRL1_PWM_MODE_3X_PWM_INLX   0x1000
#define BRUSHLESS28_GD_CTRL1_PWM_MODE_3X_PWM_SPI   0x2000
#define BRUSHLESS28_GD_CTRL1_PWM_MODE_1X_PWM   0x3000
#define BRUSHLESS28_GD_CTRL1_PWM_MODE_SPI_GATE   0x5000
#define BRUSHLESS28_GD_CTRL1_PWM_MODE_MASK   0x7000
#define BRUSHLESS28_GD_CTRL1_SGD_MODE_FIXED   0x0000
#define BRUSHLESS28_GD_CTRL1_SGD_MODE_DYNAMIC   0x0200
#define BRUSHLESS28_GD_CTRL1_SGD_MODE_MASK   0x0600
#define BRUSHLESS28_GD_CTRL1_SGD_TMP_EN   0x0100
#define BRUSHLESS28_GD_CTRL1_STP_MODE_0   0x0000
#define BRUSHLESS28_GD_CTRL1_STP_MODE_1   0x0080
#define BRUSHLESS28_GD_CTRL1_STP_MODE_MASK   0x0080
#define BRUSHLESS28_GD_CTRL1_DEADT_70NS   0x0000
#define BRUSHLESS28_GD_CTRL1_DEADT_200NS   0x0008
#define BRUSHLESS28_GD_CTRL1_DEADT_300NS   0x0010
#define BRUSHLESS28_GD_CTRL1_DEADT_500NS   0x0018
#define BRUSHLESS28_GD_CTRL1_DEADT_750NS   0x0020
#define BRUSHLESS28_GD_CTRL1_DEADT_1000NS   0x0028
#define BRUSHLESS28_GD_CTRL1_DEADT_1500NS   0x0030
#define BRUSHLESS28_GD_CTRL1_DEADT_2000NS   0x0038
#define BRUSHLESS28_GD_CTRL1_DEADT_MASK   0x0038
#define BRUSHLESS28_GD_CTRL1_DEADT_MODE_0   0x0000
#define BRUSHLESS28_GD_CTRL1_DEADT_MODE_1   0x0004
#define BRUSHLESS28_GD_CTRL1_DEADT_MODE_MASK   0x0004
#define BRUSHLESS28_GD_CTRL1_DEADT_MODE_6X_0   0x0000
#define BRUSHLESS28_GD_CTRL1_DEADT_MODE_6X_1   0x0001
#define BRUSHLESS28_GD_CTRL1_DEADT_MODE_6X_2   0x0002
#define BRUSHLESS28_GD_CTRL1_DEADT_MODE_6X_3   0x0003
#define BRUSHLESS28_GD_CTRL1_DEADT_MODE_6X_MASK   0x0003
#define BRUSHLESS28_SPI_TEST_WORD   0x5AA5
 Brushless 28 SPI test word setting.
#define BRUSHLESS28_SPI_FRAME_READ_BIT   0x01
 Brushless 28 SPI frame setting.
#define BRUSHLESS28_SPI_FRAME_CRC_DISABLE   0x00
#define BRUSHLESS28_SPI_FRAME_CRC_ENABLE   0x01
#define BRUSHLESS28_SPI_FRAME_CRC_MASK   0x01
#define BRUSHLESS28_DIR_CW   0
 Brushless 28 direction settings.
#define BRUSHLESS28_DIR_CCW   1
#define BRUSHLESS28_DEF_DUTY   0.0
 Brushless 28 default PWM frequency.
#define BRUSHLESS28_DEF_FREQ   5000
#define BRUSHLESS28_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
#define BRUSHLESS28_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
#define BRUSHLESS28_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.

Enumerations

enum  brushless28_return_value_t { BRUSHLESS28_OK = 0 , BRUSHLESS28_ERROR = -1 }
 Brushless 28 Click return value data. More...

Functions

void brushless28_cfg_setup (brushless28_cfg_t *cfg)
 Brushless 28 configuration object setup function.
err_t brushless28_init (brushless28_t *ctx, brushless28_cfg_t *cfg)
 Brushless 28 initialization function.
err_t brushless28_default_cfg (brushless28_t *ctx)
 Brushless 28 default configuration function.
err_t brushless28_write_reg (brushless28_t *ctx, uint8_t reg, uint16_t data_in)
 Brushless 28 data writing function.
err_t brushless28_read_reg (brushless28_t *ctx, uint8_t reg, uint16_t *data_out)
 Brushless 28 data reading function.
err_t brushless28_set_duty_cycle (brushless28_t *ctx, float duty_cycle)
 Brushless 28 sets PWM duty cycle.
err_t brushless28_pwm_stop (brushless28_t *ctx)
 Brushless 28 stop PWM module.
err_t brushless28_pwm_start (brushless28_t *ctx)
 Brushless 28 start PWM module.
void brushless28_set_direction (brushless28_t *ctx, uint8_t dir)
 Brushless 28 set direction function.
void brushless28_switch_direction (brushless28_t *ctx)
 Brushless 28 switch direction function.
void brushless28_pull_brake (brushless28_t *ctx)
 Brushless 28 pull brake function.
void brushless28_release_brake (brushless28_t *ctx)
 Brushless 28 release brake function.
uint8_t brushless28_get_fault_pin (brushless28_t *ctx)
 Brushless 28 get fault pin function.

Detailed Description

This file contains API for Brushless 28 Click Driver.

Enumeration Type Documentation

◆ brushless28_return_value_t

Brushless 28 Click return value data.

Predefined enum values for driver return values.

Enumerator
BRUSHLESS28_OK 
BRUSHLESS28_ERROR